package com.zhouxiaoge.compiler;

import org.mdkt.compiler.InMemoryJavaCompiler;

public class Main {
    public static void main(String[] args) throws Exception {
        StringBuilder sourceCode = new StringBuilder();
        sourceCode.append("package org.mdkt;\n");
        sourceCode.append("public class HelloClass {\n");
        sourceCode.append("   public String hello() { return \"hello\"; }");
        sourceCode.append("}");

        Class<?> helloClass = InMemoryJavaCompiler.newInstance().compile("org.mdkt.HelloClass", sourceCode.toString());
        Object o = helloClass.newInstance();
    }
}
